package classes.Commands
{
	import components.c_pcomponent;
	import components.editor.c_baseEditor;
	import components.editor.c_baseElement;
	
	public class c_deleteCommand extends c_commandFromEditor {
		private var _index: int;
		public function c_deleteCommand(a_editor: c_baseEditor, a_element:c_baseElement=null) {
			super(a_editor, a_element);
		}
		
		override public function Execute():void {
			super.Execute();
			_index 	= element.index;
			element.remove();
		}
		
		override public function unExecute():void {
			element.setParent(editor.imageLayer, _index);
			super.unExecute();
		}
		
		override public function dispose():void {
			if (!element.parent) element.dispose();
		}
	}
}